package com.cq.service.impl;

import com.cq.mapper.MeetingMapper;
import com.cq.pojo.Meeting;
import com.cq.pojo.Room;
import com.cq.pojo.User;
import com.cq.pojo.User_meeting;
import com.cq.service.MeetingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 悠久的苍穹
 * @Date: 2021/1/25 15:04
 * @Description: ${description}
 * @Version: 1.0
 */
@Service
public class MeetingServiceImpl implements MeetingService {

    @Autowired
    MeetingMapper meetingMapper;

    @Override
    public int addMeeting(Meeting meeting) {
        return meetingMapper.addMeeting(meeting);
    }

    @Override
    public List<Meeting> getMeetings(int page, int limit) {
        return meetingMapper.getMeetings((page-1)*limit,limit);
    }

    @Override
    public Meeting getMeetingById(int id) {
        return meetingMapper.getMeetingById(id);
    }

    @Override
    public int findMeeting(Meeting meeting) {
        return meetingMapper.findMeeting(meeting);
    }


    @Override
    public void addUserMeeting(String uuid, int meeting_id) {
        meetingMapper.addUserMeeting(uuid,meeting_id);
    }

    @Override
    public User findUserByMeetingId(String meetingId) {
        return meetingMapper.findUserByMeetingId(meetingId);
    }

    @Override
    public Room findRoomById(String roomId) {
        return meetingMapper.findRoomById(roomId);
    }

    @Override
    public void updateMeetingStatus(Meeting meeting) {
        meetingMapper.updateMeetingStatus(meeting);
    }

    @Override
    public void addMeetingRoom(int meetingId, int roomId) {
        meetingMapper.addMeetingRoom(meetingId,roomId);
    }

    @Override
    public void addRoom(Room room) {
        meetingMapper.addRoom(room);
    }

    @Override
    public Integer findRoomId(Room room1) {
        return meetingMapper.findRoomId(room1);
    }

    @Override
    public String getRtmpUrlByMeetingId(String id) {
        return meetingMapper.getRtmpUrlByMeetingId(id);
    }

    @Override
    public void updateMeetingHot(int id) {
        meetingMapper.updateMeetingHot(id);
    }

    @Override
    public void updateMeetingCold(int id) {
        meetingMapper.updateMeetingCold(id);
    }

    @Override
    public List<Meeting> getHotMeetings() {
        return meetingMapper.getHotMeetings();
    }

    @Override
    public int getCount() {
        return meetingMapper.getCount();
    }

    @Override
    public List<Meeting> getAllMeetings() {
        return meetingMapper.getAllMeetings();
    }

    @Override
    public int getTimeCount(String start, String end) {
        return meetingMapper.getTimeCount(start,end);
    }

    @Override
    public List<Meeting> getMeetingsByTime(int page, int limit, String start, String end) {
        return meetingMapper.getMeetingsByTime((page-1)*limit,limit,start,end);
    }

    @Override
    public void deleteMeetingById(int id) {
        meetingMapper.deleteMeetingById(id);
    }

    @Override
    public int getLiveCount() {
        return meetingMapper.getLiveCount();
    }

    @Override
    public String getRoomIdByMeetingId(String meetingId) {
        return meetingMapper.getRoomIdByMeetingId(meetingId);
    }

    @Override
    public List<Meeting> getMeetingsByJoin(String userId) {
        return meetingMapper.getMeetingsByJoin(userId);
    }

    @Override
    public List<Meeting> getMeetingsByApply(String userId) {
        return meetingMapper.getMeetingsByApply(userId);
    }

    @Override
    public Meeting findMeetingByRoomId(int roomId) {
        return meetingMapper.findMeetingByRoomId(roomId);
    }

    @Override
    public int updateFavorite(String userId, String meetingId, String flag) {
        return meetingMapper.updateFavorite(userId,meetingId,flag);
    }

    @Override
    public User_meeting findUserMeetingById(String userId, String meetingId) {
        return meetingMapper.findUserMeetingById(userId,meetingId);
    }

    @Override
    public void addUserMeetingFavorite(String userId, String meetingId) {
        meetingMapper.addUserMeetingFavorite(userId,meetingId);
    }

    @Override
    public List<Meeting> getMeetingsByFavorite(String userId) {
        return meetingMapper.getMeetingsByFavorite(userId);
    }


}
